'use strict';

const Controller = require('egg').Controller;

class UserinfoController extends Controller {
  async getusers () {
    const data = this.ctx.query;
    const { ctx } = this;
    const res = await ctx.service.userinfo.getusers(data);
    ctx.body = res;
  }
  async getuserinfo () {
    const data = this.ctx.query;
    console.log(data);
    const { ctx } = this;
    const res = await ctx.service.userinfo.getuserinfo(data);
    ctx.body = res;
  }
  // 客户端修改用户信息
  async updateuserinfo () {
    const { ctx } = this;
    const data = ctx.request.body;
    const res = await ctx.service.userinfo.updateuserinfo(data);
    ctx.body = res;
  }
  // 后端修改管理员信息
  async updateadmininfo () {
    const { ctx } = this;
    const data = ctx.request.body;
    const res = await ctx.service.userinfo.updateadmininfo(data);
    ctx.body = res;
  }
  // 删除客户
  async deluser () {
    const data = this.ctx.query;
    const { ctx } = this;
    const res = await ctx.service.userinfo.deluser(data);
    ctx.body = res;
  }
}

module.exports = UserinfoController;
